package org.xinjiang.data.migration.flush.enums;

import lombok.Getter;

/**
 * 合同
 */
@Getter
public enum ContractEnum {
    A_YEAR("1", "1年期", "1", null),
    TWO_YEARS("2", "2年期", "2", null),

    THREE_YEARS("3", "3年期", "3", null),
    NO_FIXED_TERM("4", "无固定期限", "4", null);

    /* 数据来源code
     */
    private String sourceCode;

    /**
     * 数据来源名成
     */
    private String sourceName;


    private String targetCode;

    private Integer id;

    ContractEnum(String sourceCode, String sourceName, String targetCode, Integer id) {
        this.sourceCode = sourceCode;
        this.sourceName = sourceName;
        this.targetCode = targetCode;
        this.id = id;
    }

    public static ContractEnum toCode(String sourceCode) {
        for (ContractEnum value : ContractEnum.values()) {
            if (value.sourceCode.equals(sourceCode)) {
                return value;
            }
        }
        return A_YEAR;
    }

}
